#include "StdAfx.h"
#include "dclassentity.h"
#include "dvariableentity.h"
#include "dmethodentity.h"

DClassEntity::DClassEntity(ClassType eClassType, QObject *parent)
	: DAbstractEntity(parent)
	, m_eClassType(eClassType)
	, m_pBaseClass(0)
	, m_nLevel(0)
{
	m_eEntityType = eClass;
}

DClassEntity::~DClassEntity()
{

}

void DClassEntity::addVariable(DVariableEntity* pVar)
{
	m_variables.append(pVar);
}

void DClassEntity::addMethod(DMethodEntity* pMethod)
{
	m_methods.append(pMethod);
}

const DClassEntity::Variables& DClassEntity::variables() const
{
	return m_variables;
}

const DClassEntity::Methods& DClassEntity::methods() const
{
	return m_methods;
}

DClassEntity* DClassEntity::baseClass() const
{	
	return m_pBaseClass;
}

void DClassEntity::addSubclass(DClassEntity* pClass)
{
	pClass->m_pBaseClass = this;
	pClass->m_nLevel = m_nLevel + 1;
	m_subclasses.append(pClass);
}

const QList<DClassEntity*>& DClassEntity::subclasses() const
{
	return m_subclasses;
}

void DClassEntity::removeSubclass(DClassEntity* pClass)
{
	pClass->m_pBaseClass = 0;
	m_subclasses.removeOne(pClass);
}

ClassType DClassEntity::classType() const
{
	return m_eClassType;
}

int	DClassEntity::level()
{
	return m_nLevel;
}

QString DClassEntity::toString() const
{
	return QString();
}